import Vue from 'vue'
import Vuex from 'vuex'
import {
  getPermissionInfo
} from "@/api/system/role/roleApi";

Vue.use(Vuex)

export default new Vuex.Store({
  state: {
    BaseApi: "http://113.31.109.24:9888",
    Permissions: []
  },
  getters: {
  },
  mutations: {
    SET_PERMISSIONS(state, permissions) {
      state.Permissions = permissions;
    }
  },
  actions: {
    async setUserPermissionInfo({ commit }) {
      await getPermissionInfo().then(res => {
        commit('SET_PERMISSIONS', res.data.data);
      })
    }
  },
  modules: {
  }
})
